<?php
class Cl_ShippingCompany extends WdkClass 
{
	protected
		/******************************************************/
		//	원본 테이블 정보
		/******************************************************/
		$shipping_company_seq			= 0		,	//	그룹 키값
		$shipping_company_name			= ''	,	//	그룹명
		$shipping_company_img			= 0		,	//	할인율 조건 구매금액
		$shipping_company_link			= 0		,	//	할인율
		$shipping_company_use_flag		= 'T'	,	//	누적율 조건 구매금액
		$shipping_company_insert_time	= 0		,	//	등록시간
		$shipping_company_del_flag		= 'F'	;	//	삭제여부
		/******************************************************/
		//	추가 정보
		/******************************************************/
	
	/**
	 * 	
	 */
	function __construct()
	{
		parent::__construct();
		self::getDbo();
	}
	
	/**
	 *	
	 */
	public function __init($data)
	{
		parent::__init($data);
		self::dformat();
	}
	
	/**
	 *	
	 */
	public function load($shipping_company_seq)
	{
		/*------------------------------------------------------------*/
		$dbo = self::getDbo();
		/*------------------------------------------------------------*/
		self::__init($dbo->cLoad($shipping_company_seq));
	}
	
	/**
	 *	
	 */
	public function dformat()
	{
	
	}
	
	/**
	 * 
	 */
	public function autoUpdate($log='')
	{
		if((int)$this->shipping_company_seq > 0)
		{
			$this->update($log);
		}
		else
		{
			$this->insert($log);
		}
	}
	
	/**
	 *	
	 */
	public function insert($log='Insert')
	{
		/*------------------------------------------------------------*/
		$dbo = self::getDbo();
		/*------------------------------------------------------------*/
		$this->shipping_company_insert_time	= time();
		$this->shipping_company_use_flag	= 'T';
		$this->shipping_company_del_flag	= 'F';
		
		$data = array(	'shipping_company_name'			=>	$this->shipping_company_name,
						'shipping_company_img'			=>	$this->shipping_company_img,
						'shipping_company_link'			=>	$this->shipping_company_link,
						'shipping_company_use_flag'		=>	$this->shipping_company_use_flag,
						'shipping_company_insert_time'	=>	$this->shipping_company_insert_time,
						'shipping_company_del_flag'		=>	$this->shipping_company_del_flag
					);
		$this->shipping_company_seq = $dbo->insert($data);
		$this->backup($log);
	}
	
	/**
	 * 
	 */
	public function update($log='update')
	{
		/*------------------------------------------------------------*/
		$dbo = self::getDbo();
		/*------------------------------------------------------------*/

		$data = array(	'shipping_company_name'			=>	$this->shipping_company_name,
						'shipping_company_img'			=>	$this->shipping_company_img,
						'shipping_company_link'			=>	$this->shipping_company_link,
						'shipping_company_use_flag'		=>	$this->shipping_company_use_flag
					);
		$dbo->update($data, array("shipping_company_seq = ".$this->shipping_company_seq));
		$this->backup($log);
	}
	
	/**
	 * 
	 */
	public function delete($log='delete')
	{
		/*------------------------------------------------------------*/
		$dbo = self::getDbo();
		/*------------------------------------------------------------*/
		$dbo->delete(array("shipping_company_seq = ".$this->shipping_company_seq));
		$this->backup($log);
	}
	
	/**
	 *	
	 */
	private function backup($log='')
	{
// 		/*------------------------------------------------------------*/
// 		$dbo = self::getDbo();
// 		/*------------------------------------------------------------*/
// 		$dbo->log($this->user_seq, $log, $this->backup_data);
	}
	
	/**
	 * 
	 */
	public function getDbo()
	{
		return Wdk::model(substr(__CLASS__, 3));
	}
}